<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ page contentType="text/html;charset=UTF-8" language="java" import="com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="java.util.*" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/baseProductList.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML>
<HEAD>
<TITLE>ScalarSoft - ChipTrac</TITLE>
<script src='<%=chipTracContext%>/jsp/includes/scripts/quickSearch.js'></script>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href='<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css' type='text/css' rel='stylesheet'>
<SCRIPT LANGUAGE="JavaScript">

window.onload=init;

function init()
{
    qs_1 = new QuickSearch(document.baseProductForm['partNumber'], document.baseProductForm.qs1, false);
}

function searchForBaseProducts()
{
    var form = document.baseProductForm;
    var errors = ""

    if( form.partNumber.value == "-1" )
    {
        document.baseProductForm.action = '<%=chipTracContext%>/baseProductList.do';
        document.baseProductForm.submit();
    }
    else
    {
        document.baseProductForm.action = '<%=chipTracContext%>/baseProductList.do?action=searchNew';
        document.baseProductForm.submit();
    }
}

function openPmfFile ( productId )
{
	newWindow = window.open ( '<%=chipTracContext%>/generateFile.do?baseProductID='+productId,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=450,height=150,resizable=no');
    newWindow.focus();

}

function syncdata()
{
	newWindow = window.open ("<%=chipTracContext%>/syncProducts.do",'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=350,height=100,,left=350,top=250,resizable=yes');
    newWindow.focus();
}

function reset()
{
    document.baseProductForm.reset();
    qs_1.resetQuickSearchCntrl();
}

</SCRIPT>
</HEAD>
<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0'>
<!-- Top Header Start-->
<%@include file="/jsp/includes/header.jsp"%>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TBODY>
    <TR>
	    <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%@include file="/jsp/operations/product_menu.jsp"%>
            <!-- end of the side navigations -->
        </TD>
        <TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR><BR>
            <!-- from here your body starts -->
            <html:form name = "baseProductForm" method="POST" action="/baseProductList.do" type ='com.scalar.chiptrack.operations.process.forms.BaseProductForm' onsubmit = 'searchForBaseProducts();'>
            <table border="0" width="60%" bordercolor="#FFFFFF" align="center">
            <tr><td align="center" colSpan = "4" class="NArialW"> Product Setup </td></tr>
            <tr><td class="NArialL" colspan=4><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
            <TR><TD colspan=4>
                <chiptrack:info styleClass="NArialL" />
                <chiptrack:errors styleClass="NArialL" />
                <chiptrack:messages type="info" styleClass="NArialL" />
            </TD></TR>
            <tr>
                <td class="NArialL">Quick<br>Search Part No:</td>
                <td class="NArialL">
                    <input type="text" name="qs1" class="txfield" size='25' onkeyup='quickSearch(qs_1)'/>
                </td>
                <td colspan='2'>&nbsp;</td>
            </tr>
            <tr>
                <td class="NArialL">Part Number:</td>
                <td class="NArialL">
                    <nested:select property="partNumber" styleClass="txfield">
                        <html:option value="-1">All Part Numbers</html:option>
                        <html:options collection="partNumberList" property="value" labelProperty="label"/>
                    </nested:select>
                </td>
                <td colspan='2'>&nbsp;</td>
             </tr>
             <tr><td class="NArialL" colspan=4><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
             <tr>
                <td colspan="5" align="center">
                    <a href="javascript:searchForBaseProducts();" onmouseover="window.status='Click to Search for Base Product';return true" onmouseout="window.status='';return true"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" title="Click to Search for Base Product"/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="javascript:reset()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
                </td>
            </tr>
            <tr><td class="NArialL" colspan=4><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
            <tr>
                <td class="NArialL" colspan=4>
                    To add a new Base Product, please <A HREF="<%=chipTracContext%>/productsetup.do" onmouseover="window.status='Click to Add New Base Product';return true" onmouseout="window.status='';return true">click here</A>
                </td>
            </tr>
            <tr><td class="NArialL" colspan=4><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
            <tr>
                <td width="20%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Base Product Name</font></font></td>
                <td width="20%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Process View</font></font></td>
                <%--<td width="20%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Generate File</font></font></td>--%>
                <td width="20%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Action</font></font></td>
            </tr>
		    <% int bgcount=0;%>
		    <logic:iterate id="Product" name="productList">
			<logic:notEqual parameter="Product" value="null">
            <%bgcount = bgcount+1;%>
			<tr>

                <td width="20%" align="center" <%if(bgcount%2==0){%> bgcolor="#DEE1E2"<%}else{%>bgcolor="#FFFFEE"><%}%><font class="NArialL">
                    <bean:write name="Product" property="productName"/></font>
                </td>
                <td width="20%" align="center" <%if(bgcount%2==0){%> bgcolor="#DEE1E2"<%}else{%>bgcolor="#FFFFEE"><%}%>
                    <font class="NArialL">
                    <logic:equal name="Product" property="obsolete" value="false">
                    <a href="<%=chipTracContext%>/processView.do?baseProductID=<bean:write name="Product" property="productId"/>&baseProductName=<bean:write name="Product" property="productName"/>" onmouseover="window.status='Click to View the Process';return true" onmouseout="window.status='';return true">Process View</a>
                    </logic:equal>
                    <logic:equal name="Product" property="obsolete" value="true">
                    Process View
                    </logic:equal>
                    </font>
                </td>
                <%--<td width="20%" align="center" <%if(bgcount%2==0){%> bgcolor="#DEE1E2"<%}else{%>bgcolor="#FFFFEE"><%}%>
                    <font class="NArialL">
                    <logic:equal name="Product" property="obsolete" value="false">
                    <a href='javaScript:openPmfFile(<bean:write name="Product" property="productId"/>);' onmouseover="window.status='Click to Generate the File';return true" onmouseout="window.status='';return true">Generate File</a>
                    </logic:equal>
                    <logic:equal name="Product" property="obsolete" value="true">
                    Generate File
                    </logic:equal>
                    </font>                    
                </td>--%>
                <td width="20%" align="center" <%if(bgcount%2==0){%> bgcolor="#DEE1E2"<%}else{%>bgcolor="#FFFFEE"><%}%>
                    <font class="NArialL">
                    <logic:equal name="Product" property="obsolete" value="false">
                    <a href="<%=chipTracContext%>/baseProductList.do?baseProductID=<bean:write name="Product" property="productId"/>&baseProductName=<bean:write name="Product" property="productName"/>&action=obsolete" onmouseover="window.status='Click to Obsolte the Product';return true" onmouseout="window.status='';return true">Obsolete</a>
                    </logic:equal>
                    <logic:equal name="Product" property="obsolete" value="true">
                    <a href="<%=chipTracContext%>/baseProductList.do?baseProductID=<bean:write name="Product" property="productId"/>&baseProductName=<bean:write name="Product" property="productName"/>&action=activate" onmouseover="window.status='Click to Activate the Product';return true" onmouseout="window.status='';return true"><font color='red'>Activate</font></a>
                    </logic:equal>
                    </font>
                </td>
            </tr>
			</logic:notEqual>
		    </logic:iterate>
        </table>
        </html:form>
        <!-- till here -->
        <BR><BR><BR></TD>
        <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
</TABLE>
<!-- Footer starts here -->
<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>
